package com.alks.function.controller;


import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.entity.SdPosition;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.request.sys.PcCuttingProcessDetailRequest;
import com.alks.function.data.request.sys.SdPositionRequest;
import com.alks.function.data.request.sys.SdVendorAddRequest;
import com.alks.function.service.SdPositionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

@ApiRestController("/SdPosition")
@Api(tags ={"系统管理-职务管理","系统管理-生产基础资料定义","系统管理-厂商资料建档"})
@Slf4j
public class SdPositionController {

    @Autowired
    private SdPositionService sdPositionService;

    @WebLogger
    @ApiOperation(tags = "系统管理-职务管理", value = "查询职务")
    @PostMapping("/GetSdPosition")
    public ResponseInfo GetSdPosition(@RequestBody SdPositionRequest request) {
        return sdPositionService.GetSdPosition(request);
    }

    @WebLogger
    @ApiOperation(tags = "系统管理-职务管理", value = "添加职务")
    @PostMapping("AddSdPosition")
    public ResponseInfo AddSdPosition(@RequestBody SdPosition sdPosition){
        return sdPositionService.AddSdPosition(sdPosition);
    }

    @WebLogger
    @ApiOperation(tags = "系统管理-职务管理", value = "删除职务")
    @PostMapping("/delSdPosition")
    public ResponseInfo delSdPosition(@RequestParam(value = "posId") String posId){
        return sdPositionService.delPosition(posId);
    }

    @WebLogger
    @ApiOperation(tags = "系统管理-职务管理", value = "修改")
    @PutMapping("/updateSdPosition")
    public ResponseInfo updateSdPosition(@RequestBody SdPosition sdPosition){
        return sdPositionService.updateSdPosition(sdPosition);
    }

    @WebLogger
    @ApiOperation(tags = "系统管理-生产基础资料定义", value = "工序资料查询")
    @GetMapping("/ProcessDataQuery")
    public ResponseInfo ProcessDataQuery(){
        return sdPositionService.ProcessDataQuery();
    }

    @WebLogger
    @ApiOperation(tags = "系统管理-生产基础资料定义", value = "工序资料")
    @PostMapping("/pcCuttingProcess/{choose}")
    public ResponseInfo pcCuttingProcess(@RequestParam(value = "processCode") String processCode,
                                       @RequestParam(value = "processName") String processName,
                                       @PathVariable("choose")@ApiParam("0增,1修,2删") Integer choose){
        return sdPositionService.pcCuttingProcess(processCode,processName,choose);
    }

    @WebLogger
    @ApiOperation(tags = "系统管理-生产基础资料定义", value = "工艺资料查询")
    @GetMapping("/PcCuttingProcessDetailQuery")
    public ResponseInfo PcCuttingProcessDetailQuery(@RequestParam(value = "processCode") String processCode){
        return sdPositionService.PcCuttingProcessDetailQuery(processCode);
    }

    @WebLogger
    @ApiOperation(tags = "系统管理-生产基础资料定义", value = "工艺资料")
    @PostMapping("/PcCuttingProcessDetail/{choose}")
    public ResponseInfo PcCuttingProcessDetail(@RequestBody PcCuttingProcessDetailRequest request,
                                                @PathVariable("choose")@ApiParam("0增,1修,2删") Integer choose){
        return sdPositionService.PcCuttingProcessDetail(request,choose);
    }

    @WebLogger
    @ApiOperation(tags = "系统管理-厂商资料建档", value = "增加")
    @PostMapping("/SdVendorAdd")
    public ResponseInfo SdVendorAdd(@RequestBody SdVendorAddRequest request){
        return sdPositionService.SdVendorAdd(request);
    }

    @WebLogger
    @ApiOperation(tags = "系统管理-厂商资料建档", value = "查询")
    @PostMapping("/SdVendorList")
    public ResponseInfo SdVendorList(@RequestBody SdVendorAddRequest request){
        return sdPositionService.SdVendorList(request);
    }

    @WebLogger
    @ApiOperation(tags = "系统管理-厂商资料建档", value = "修改")
    @PutMapping("/SdVendorUpdate")
    public ResponseInfo SdVendorUpdate(@RequestBody SdVendorAddRequest request){
        return sdPositionService.SdVendorUpdate(request);
    }

    @WebLogger
    @ApiOperation(tags = "系统管理-厂商资料建档", value = "删除")
    @PutMapping("/SdVendorDel")
    public ResponseInfo SdVendorDel(@RequestBody SdVendorAddRequest request){
        return sdPositionService.SdVendorDel(request);
    }

    @WebLogger
    @ApiOperation(tags = "系统管理-厂商资料建档", value = "导出")
    @PostMapping("/exportSdVendor")
    public void exportSdVendor(@RequestBody SdVendorAddRequest request, HttpServletResponse response){
        sdPositionService.exportSdVendor(request,response);
    }
}
